/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufc.quixada.adrs.util;

import br.ufc.quixada.adrs.model.Adrs;
import br.ufc.quixada.adrs.service.AdrsService;
import java.util.List;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Escritorio projetos
 */
public final class Paginacao {

    public static final Long LIMIT = 20L;

    /**
     * Overcomes the default constructor. Utility classes should be final and must not have public constructors.
     */
    private Paginacao() {
    }

    static public void atualizarListaAdrs(AdrsService adrsServ, HttpSession session, Long paginaAtual, Long offset) {
        List<Adrs> lista = adrsServ.getPaginaAdrs(offset, LIMIT);
        Long numAdrs = adrsServ.countNumeroAdrs();
        session.setAttribute("numAdrs", numAdrs);
        session.setAttribute("pagina", paginaAtual);
        session.setAttribute("listaAdrs", lista);
    }
}
